package usb;

import java.io.File;

/**
 * 场景：线程启动，检测用户是否在规定的时间内插入U盘设备。
 *
 * @author spencercjh
 */
public class EncryptPrepare {
    /**
     * 检测到新的U盘设备就返回true
     *
     * @return hasNew
     */
    public static String init() {
        DiskSearchThread thread = new DiskSearchThread();
        thread.run();
        File newDevice = DiskSearchThread.newDevice;
        if (newDevice != null) {
            return String.valueOf(DiskSearchThread.newDevice);
        } else {
            return "error";
        }
    }

    public static void main(String[] args) {
        new DiskSearchThread() {
        }.run();
    }
}
